<?php
/**
 * Created by IntelliJ IDEA.
 * User: Lukáš
 * Date: 20.12.11
 * Time: 22:20
 * To change this template use File | Settings | File Templates.
 */

$this->headTitle('Tituly | Knihovna');
?>

<h2>Seznam titulů</h2>
<p><a class="add" href="<?php echo $this->url(array('module'     => 'admin',
    'controller' => 'titul',
    'action'     => 'add'));?>">Pridej titul</a></p>

<?php
foreach ($this->message as $key => $value)
{
    $value = explode("|", $value);
    ?>
<div class="message <?php print $value[0]; ?>"><p><?php print $value[1]; ?></p></div>
<?php

}

// Nema cenu vypisovat tabulku, pokud je DB tabulka prazdna
if (count($this->titul) > 0) {

    ?>
<table id="tabulka" class="ui-widget ui-widget-content">
    <tr class="ui-widget-header">
        <th>ID</th>
        <th>Název</th>
        <th>Před jménem</th>
        <th>Akce</th>
    </tr>


    <?php
    foreach ($this->titul as $titul)
    {
        ?>
        <tr>
            <td><?php echo $this->escape($titul->id_titulu);?></td>
            <td><?php echo $this->escape($titul->nazev);?></td>
            <td><?php if (($this->escape($titul->predjmenem))==1) {echo 'ano';} else {echo 'ne';}?></td>
            <td>
                <a class="edit" href="<?php echo $this->url(array('module'     => 'admin',
                    'controller' => 'titul',
                    'action'     => 'edit',
                    'id_titulu'   => $titul->id_titulu));?>">Upravit</a>
                <a class="delete" href="<?php echo $this->url(array('module'     => 'admin',
                    'controller' => 'titul',
                    'action'     => 'delete',
                    'id_titulu'   => $titul->id_titulu));?>">Smazat</a>
            </td>
        </tr>
        <?php

    } // konec foreach (vypisu abulky)
    ?>
</table>

<?php

}

else {
    ?>

<p>Tabulka titulů je prázdná.</p>

<?php

}
?>
